//
//  NSString+Extension.m
//  Tradeaider
//
//  Created by 王方伟 on 16/8/3.
//  Copyright © 2016年 Shinyhub. All rights reserved.
//

#import "NSString+Extension.h"

@implementation NSString (Extension)
#pragma mark 获取文字尺寸(根据指定大小)
-(CGSize)sizeWithFont:(UIFont *)font maxSize:(CGSize)maxSize{
    NSDictionary *attr=@{NSFontAttributeName:font};
    return [self boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attr context:nil].size;
}

#pragma mark 获取文字尺寸
-(CGSize)sizeWithFont:(UIFont *)font{
    return [self sizeWithFont:font maxSize:CGSizeMake(MAXFLOAT, MAXFLOAT)];
}
@end
